package com.xnyzc.lhy.order.service.impl.order;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.xnyzc.lhy.common.component.redis.RedisCommon;
import com.xnyzc.lhy.common.constant.MqConstant;
import com.xnyzc.lhy.common.constant.RedisPrefixConstant;
import com.xnyzc.lhy.common.entity.Rv;
import com.xnyzc.lhy.common.exception.DiDiException;
import com.xnyzc.lhy.common.penum.EDiDiErrorCode;
import com.xnyzc.lhy.common.penum.EDispatchType;
import com.xnyzc.lhy.common.penum.EErrorCode;
import com.xnyzc.lhy.common.penum.EOrderType;
import com.xnyzc.lhy.common.penum.order.EDiDiOrderStatus;
import com.xnyzc.lhy.common.penum.vehicle.EvehicleType;
import com.xnyzc.lhy.common.util.CheckUtil;
import com.xnyzc.lhy.common.util.IDUtil;
import com.xnyzc.lhy.common.util.StringUtil;
import com.xnyzc.lhy.order.entity.order.OaCOrderPersonal;
import com.xnyzc.lhy.order.entity.mq.OrderParam;
import com.xnyzc.lhy.order.entity.param.order.OrderDetailParam;
import com.xnyzc.lhy.order.entity.param.order.OrderExpressParam;
import com.xnyzc.lhy.order.entity.param.order.OrderResults;
import com.xnyzc.lhy.order.entity.result.order.OrderDetailResults;
import com.xnyzc.lhy.order.entity.result.order.OrderDetailResults1;
import com.xnyzc.lhy.order.entity.result.order.OrderList;
import com.xnyzc.lhy.order.entity.result.order.OrderResult;
import com.xnyzc.lhy.order.entity.system.OaSysDispatchLog;
import com.xnyzc.lhy.order.entity.task.OrderStatusResults;
import com.xnyzc.lhy.order.entity.user.OaDUser;
import com.xnyzc.lhy.order.entity.user.OaDUserInfo;
import com.xnyzc.lhy.order.entity.vehicle.OaSysVehicle;
import com.xnyzc.lhy.order.mapper.order.OaCOrderPersonalMapper;
import com.xnyzc.lhy.order.mapper.user.OaDUserInfoMapper;
import com.xnyzc.lhy.order.mapper.user.OaDUserMapper;
import com.xnyzc.lhy.order.mapper.vehicle.OaSysVehicleMapper;
import com.xnyzc.lhy.order.mq.MqOrderProducer;
import com.xnyzc.lhy.order.service.order.IOrderExpressService;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.connection.ConnectionUtils;
import org.springframework.stereotype.Service;

import java.math.BigDecimal;
import java.text.SimpleDateFormat;
import java.util.*;

/**
 * 快车订单
 */
@Service
@Slf4j
public class OrderExpressServiceImpl extends ServiceImpl<OaCOrderPersonalMapper, OaCOrderPersonal> implements IOrderExpressService {

    @Autowired
    private OaCOrderPersonalMapper oaCOrderPersonalMapper;

    @Autowired
    private OaSysVehicleMapper oaSysVehicleMapper;

    @Autowired
    private OaDUserMapper oaDUserMapper;

    @Autowired
    private OaDUserInfoMapper oaDUserInfoMapper;

    @Autowired
    private MqOrderProducer producer;

    @Autowired
    private RedisCommon redisCommon;

    @Override
    public Rv getOrderDetail(String orderNo,Long userId) {

        if (StringUtils.isBlank(orderNo)){
            return Rv.error(EErrorCode.missingArg);
        }

        OrderDetailResults1 results = new OrderDetailResults1();
        OaCOrderPersonal personal = getOaCOrderPersonalVersion(orderNo);

        QueryWrapper<OaCOrderPersonal> queryVersion = new QueryWrapper<>();
        queryVersion.eq(OaCOrderPersonal.ORDER_NO, orderNo);
        queryVersion.eq(OaCOrderPersonal.VERSION,personal.getVersion());

        OaCOrderPersonal orderPersonal=oaCOrderPersonalMapper.selectOne(queryVersion);
        if (orderPersonal==null) {
            throw DiDiException.create(EDiDiErrorCode.orderPersonalSelectFail);
        }

        // 修改订单表
        UpdateWrapper<OaCOrderPersonal> updateWrapper = new UpdateWrapper<>();

        results.setOrderState(getState(orderPersonal.getOrderStatus()).toString());
        //车辆类型
        if(orderPersonal.getVehicleId()!=null){
            QueryWrapper<OaSysVehicle> queryVehicle = new QueryWrapper<>();
            queryVehicle.eq(OaSysVehicle.VEHICLE_ID,orderPersonal.getVehicleId());
            OaSysVehicle vehicle= oaSysVehicleMapper.selectOne(queryVehicle);
            if(vehicle!=null&&vehicle.getVehType()!=null){
                results.setCarTypeName(EvehicleType.findById(vehicle.getVehType()).getValue());
            }
            results.setCarnum(vehicle.getVehNo());
        }

        results.setUserId(userId);

        //司机相关
        if(orderPersonal.getDriverId()!=null){
            QueryWrapper<OaDUser> query = new QueryWrapper<>();
            query.eq(OaDUser.DRIVER_ID,orderPersonal.getDriverId());
            OaDUser dUser=oaDUserMapper.selectOne(query);
            if(dUser!=null){
                results.setDriverId(dUser.getDriverId());
                results.setDname(StringUtil.isBlank(dUser.getNickName())?dUser.getDriverName():dUser.getNickName());
                results.setHeadUrl(""+dUser.getAvatarFileId());
                results.setDphone(dUser.getDriverPhone());
                QueryWrapper<OaDUserInfo> queryUserInfo = new QueryWrapper<>();
                queryUserInfo.eq(OaDUser.DRIVER_ID,orderPersonal.getDriverId());
                OaDUserInfo dUserInfo=oaDUserInfoMapper.selectOne(queryUserInfo);
                if(dUserInfo!=null){
                    results.setGordernum(dUserInfo.getOrderQuantityCompleted()==null?"0":dUserInfo.getOrderQuantityCompleted().toString());
                    results.setEscore(dUserInfo.getTotalServiceScore().toString());
                    results.setDtype(dUserInfo.getDriverType().toString());
                }
            }
        }

        results.setOrderId(orderNo);
        results.setOrdernum(orderNo);
        if(orderPersonal.getTotalFee()!=null){
            results.setOrdermoney(orderPersonal.getTotalFee().setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue());
        }else {
            results.setOrdermoney(0d);
        }
        if(orderPersonal.getActualFee()!=null){
            results.setTotalFee(orderPersonal.getActualFee().setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue());
        }else {
            results.setTotalFee(0d);
        }
//        其他费用
        results.setOrderType(orderPersonal.getOrderType().toString());
        if(orderPersonal.getCouponDeductionFee()!=null){
            results.setDeducmoney(orderPersonal.getCouponDeductionFee().setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue());
        }else {
            results.setDeducmoney(0d);
        }
        if(orderPersonal.getServiceFee()!=null){
            results.setServermoney(orderPersonal.getServiceFee().setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue());
        }else {
            results.setServermoney(0d);
        }
        if(orderPersonal.getStartFee()!=null){
            results.setStartmoney(orderPersonal.getStartFee().setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue());
        }else {
            results.setStartmoney(0d);
        }
        if(orderPersonal.getStartMileage()!=null){
            results.setStartmileage(orderPersonal.getStartMileage().longValue());
        }else {
            results.setStartmileage(0l);
        }
        //等待时间
        if(orderPersonal.getArriveMeetPassengerTime()!=null){
            results.setWaittime(orderPersonal.getArriveMeetPassengerTime().getTime());
        }else {
            results.setWaittime(0l);
        }
        if(orderPersonal.getMileageFee()!=null){
            results.setMileagemoney(orderPersonal.getMileageFee().setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue());
        }

        if(orderPersonal.getPaymentType()!=null){
            results.setSubject(orderPersonal.getPaymentType().toString());
        }

//            if (StringUtils.isNotBlank(dataObject.getString("passenger_phone"))) {
//                results.setPassenger_phone(dataObject.getString("passenger_phone"));
//                updateWrapper.set(OaCOrderPersonal.PASSENGER_PHONE, results.getPassenger_phone());
//            }
//            if (StringUtils.isNotBlank(dataObject.getString("passenger_phone_suffix"))) {
//                results.setPassenger_phone_suffix(dataObject.getString("passenger_phone_suffix"));
//                updateWrapper.set(OaCOrderPersonal.PASSENGER_PHONE_SUFFIX, results.getPassenger_phone_suffix());
//            }
        updateWrapper.set(OaCOrderPersonal.VERSION, personal.getVersion() + 1);
        updateWrapper.set(OaCOrderPersonal.UPDATE_TIME, new Date());
        updateWrapper.eq(OaCOrderPersonal.ORDER_NO, orderNo);
        updateWrapper.eq(OaCOrderPersonal.VERSION, personal.getVersion());
        try {
            int update = oaCOrderPersonalMapper.update(null, updateWrapper);
            if (update < 1) {
                throw DiDiException.create(EDiDiErrorCode.orderPersonalUpdateFail);
            }
        } catch (Exception e) {
            log.error(e.getMessage());
            throw DiDiException.create(EDiDiErrorCode.orderPersonalUpdateFail);
        }
        return Rv.wrap(results);

    }


    /**
     * 查询version
     *
     * @return OaCOrderPersonal
     */
    private OaCOrderPersonal getOaCOrderPersonalVersion(String orderNo) {
        // 查询version
        QueryWrapper<OaCOrderPersonal> queryVersion = new QueryWrapper<>();
        queryVersion.select(OaCOrderPersonal.VERSION,OaCOrderPersonal.ORDER_STATUS);
        queryVersion.eq(OaCOrderPersonal.ORDER_NO, orderNo);
        List<OaCOrderPersonal> oaCOrderPersonals = oaCOrderPersonalMapper.selectList(queryVersion);
        if (CheckUtil.collectionIsEmpty(oaCOrderPersonals)) {
            throw DiDiException.create(EDiDiErrorCode.orderPersonalSelectFail);
        }
        return oaCOrderPersonals.get(0);
    }

    @Override
    public Rv getOrderStatus(String orderId,Long userId) {

        if (StringUtils.isBlank(orderId)){
            return Rv.error(EErrorCode.missingArg);
        }
        OrderStatusResults results = new OrderStatusResults();
        OaCOrderPersonal personal = getOaCOrderPersonalVersion(orderId);
        EDiDiOrderStatus byDidiType = EDiDiOrderStatus.findById(personal.getOrderStatus());
        results.setStatus(getState(personal.getOrderStatus()).toString());
        results.setStatusDesc(byDidiType.getValue());
        return Rv.wrap(results);
    }


    @Override
    public Rv getCreateOrder(OrderParam orderParam) {

        log.info("=======创建订单接口参数======:"+orderParam.toString());

        OrderResults param = new OrderResults();
        if (orderParam.getUserId()==null ||
                StringUtils.isBlank(orderParam.getUphone()) ||
//            orderParam.getIs_carpool()==null ||
            StringUtils.isBlank(orderParam.getEstimateId())){
            return Rv.error(EErrorCode.missingArg);
        }

        Long time = System.currentTimeMillis();
        // 获取估价单
        String estimateKey = RedisPrefixConstant.DIDI_ESTIMATE + orderParam.getEstimateId();
        HashMap<String, Object> hashMap = redisCommon.getHashMap(estimateKey);
        // 生成新的订单ID
        String orderNo = orderNo();
        orderParam.setOrderNo(orderNo);
        long personalId = IDUtil.nextId();
        orderParam.setPersonalId(personalId);
        // 订单orderNo
        if (hashMap == null) {
            log.error("Redis中没有预估价格，创建订单失败！");
            return Rv.error(EErrorCode.orderCreateFail);
        }
        // 将MQ服务间调用更改为直发
        producer.sendMsg(orderParam, MqConstant.DIDI_CREATE_ORDER);
        Map<String, String> map = new HashMap<>(4);
        map.put("orderId", orderNo);
        log.info("创建订单接口返回成功");
        //创建订单
        try {
            OaSysDispatchLog dispatchLog = new OaSysDispatchLog();
            dispatchLog.setType(EDispatchType.createOrderBefore.getType());
            dispatchLog.setOrderId(orderNo);
            dispatchLog.setTimestamp(time);
            dispatchLog.setLogId(IDUtil.nextId());
            dispatchLog.setCityId(hashMap.get("cityCode").toString());
            producer.sendMsg(dispatchLog, EDispatchType.createOrderBefore.getDesc());
        } catch (Exception e) {
            log.error("记录订单调度日志!");
        }
        return Rv.wrap(map);
    }


    @Override
    public Rv cancelOrder(OrderParam orderParam) {

        if (StringUtils.isBlank(orderParam.getOrderId())){
            return Rv.error(EErrorCode.missingArg);
        }

        OrderDetailParam param=new OrderDetailParam();
        param.setOrder_id(orderParam.getOrderId());
        param.setCancel_reason(orderParam.getCancelReason());
        // 取消订单修改状态
        producer.sendMsg(param, MqConstant.DIDI_CANCEL_ORDER);
        return Rv.wrap();
    }

    /**
     * 获取订单ID
     *
     * @return
     */
    public static String orderNo() {
        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyyMMdd");
        //当前时间
        String date = simpleDateFormat.format(new Date());
        //当前类型
        String orderType = EOrderType.ZFJC.getValue();
        long s = (long) ((Math.random() * 9 + 1) * 100000000);
        return orderType + date + s;
    }

    @Override
    public Rv billDetails(OrderExpressParam orderExpressParam) {
        return null;
    }

    @Override
    public Rv getUserOrder(OrderParam orderParam) {

        QueryWrapper<OaCOrderPersonal> queryOrder = new QueryWrapper<>();
//        queryOrder.select(OaCOrderPersonal.VERSION,OaCOrderPersonal.ORDER_STATUS);
        queryOrder.eq(OaCOrderPersonal.USER_ID, orderParam.getUserId());
        if(orderParam.getType()!=null&&orderParam.getType()==1){
            //待支付
            queryOrder.in(OaCOrderPersonal.ORDER_STATUS,7,8,14);
        }
        queryOrder.orderByDesc(OaCOrderPersonal.CREATE_TIME);
        queryOrder.last(" limit "+(orderParam.getPageNum()-1)*orderParam.getPageSize()+","+orderParam.getPageSize());
        List<OaCOrderPersonal> oaCOrderPersonals = oaCOrderPersonalMapper.selectList(queryOrder);

        OrderResult results=new OrderResult();
        results.setHasNext(false);
        results.setCurrentPageNum(orderParam.getPageNum());
        if(oaCOrderPersonals!=null&&oaCOrderPersonals.size()>0){
            List<OrderList> orderList=new ArrayList<>();
            for (OaCOrderPersonal orderPersonal:oaCOrderPersonals){
                OrderList order=new OrderList();
                order.setAddTime(orderPersonal.getCreateTime().getTime());
                order.setOrderId(orderPersonal.getOrderNo());
                order.setState(getState(orderPersonal.getOrderStatus()));
                order.setOrderType(orderPersonal.getOrderType());
                order.setTravelTime(0d);
                if(orderPersonal.getDurationTime()!=null){
                    order.setTravelTime(orderPersonal.getDurationTime().doubleValue());
                }
                order.setStartAdd(orderPersonal.getStartAddress());
                order.setEndAdd(orderPersonal.getEndAddress());
                orderList.add(order);
            }
            results.setOrderList(orderList);
            if(orderList.size()==orderParam.getPageSize()){
                results.setHasNext(true);
            }
        }
        return Rv.wrap(results);
    }

    @Override
    public Rv pullPageData(Long userId) {

        OrderStatusResults results = new OrderStatusResults();

        //获取用户最新订单号
        QueryWrapper<OaCOrderPersonal> queryVersion = new QueryWrapper<>();
        queryVersion.eq(OaCOrderPersonal.DELETED, 0);
        queryVersion.eq(OaCOrderPersonal.USER_ID,userId);
        queryVersion.orderByDesc(OaCOrderPersonal.CREATE_TIME);
        queryVersion.last("limit 1");
        OaCOrderPersonal oaCOrder = oaCOrderPersonalMapper.selectOne(queryVersion);
        TimeZone.setDefault(TimeZone.getTimeZone("GMT+8"));
        Calendar cal = Calendar.getInstance();
        results.setCurrentTime(cal.getTimeInMillis());
        if(oaCOrder!=null&&StringUtils.isNotBlank(oaCOrder.getOrderNo())){
            OaCOrderPersonal personal = getOaCOrderPersonalVersion(oaCOrder.getOrderNo());
//            EDiDiOrderStatus byDidiType = EDiDiOrderStatus.findById(oaCOrder.getOrderStatus());
            results.setState(getState(personal.getOrderStatus()));
            results.setStatus(getStateDes(personal.getOrderStatus()));
            results.setStatusDesc(getStateDes(personal.getOrderStatus()));

            //车辆类型
            if(oaCOrder.getVehicleId()!=null){
                QueryWrapper<OaSysVehicle> queryVehicle = new QueryWrapper<>();
                queryVehicle.eq(OaSysVehicle.VEHICLE_ID,oaCOrder.getVehicleId());
                OaSysVehicle vehicle= oaSysVehicleMapper.selectOne(queryVehicle);
                if(vehicle!=null&&vehicle.getVehType()!=null){
                    results.setCartypename(EvehicleType.findById(vehicle.getVehType()).getValue());
                }
                results.setCarnum(vehicle.getVehNo());
            }
            results.setUserId(userId);
            //司机相关
            if(oaCOrder.getDriverId()!=null){
                results.setDriverId(oaCOrder.getDriverId());
                QueryWrapper<OaDUser> query = new QueryWrapper<>();
                query.eq(OaDUser.DRIVER_ID,oaCOrder.getDriverId());
                OaDUser dUser=oaDUserMapper.selectOne(query);
                if(dUser!=null){
                    results.setDriverId(dUser.getDriverId());
                    results.setDname(StringUtil.isBlank(dUser.getNickName())?dUser.getDriverName():dUser.getNickName());
                    results.setHeadUrl(""+dUser.getAvatarFileId());
                    results.setDphone(dUser.getDriverPhone());
                    QueryWrapper<OaDUserInfo> queryUserInfo = new QueryWrapper<>();
                    queryUserInfo.eq(OaDUser.DRIVER_ID,oaCOrder.getDriverId());
                    OaDUserInfo dUserInfo=oaDUserInfoMapper.selectOne(queryUserInfo);
                    if(dUserInfo!=null){
                        results.setOrderCount(dUserInfo.getOrderQuantityCompleted()==null?0:dUserInfo.getOrderQuantityCompleted());
                        results.setScore(dUserInfo.getTotalServiceScore());
                    }
                }
            }
            results.setStartAdd(oaCOrder.getStartAddress());
            results.setEndAdd(oaCOrder.getEndAddress());
            results.setStartlat(oaCOrder.getStartLat());
            results.setStartlon(oaCOrder.getStartLng());
            results.setEndlat(oaCOrder.getEndLat());
            results.setEndlon(oaCOrder.getEndLng());
            if(oaCOrder.getMilageDistance()!=null){
                results.setDistance(oaCOrder.getMilageDistance().toString());
            }

            results.setOrderNo(oaCOrder.getOrderNo());
            results.setOrdernum(oaCOrder.getOrderNo());
            results.setOrderId(oaCOrder.getOrderNo());
            if(oaCOrder.getEstimateDistance()!=null){
                results.setDur(oaCOrder.getEstimateDistance().setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue()*1000);
            }else {
                results.setDur(0l);
            }
            if(oaCOrder.getEstimateTime()!=null){
                results.setTime(oaCOrder.getEstimateTime().setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue()*60);
            }else {
                results.setTime(0l);
            }

            results.setIsblance(0);
            results.setWaitmoney(0d);
            if(oaCOrder.getTotalFee()!=null){
                results.setPaymoney(oaCOrder.getTotalFee().setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue());
            }else {
                results.setPaymoney(0d);
            }
            if(oaCOrder.getTotalFee()!=null){
                results.setOrdermoney(oaCOrder.getTotalFee().setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue());
            }else {
                results.setOrdermoney(0d);
            }
            if(oaCOrder.getMilageDistance()!=null){
                results.setMileage(oaCOrder.getMilageDistance().setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue());
            }else {
                results.setMileage(0d);
            }
            if(oaCOrder.getCouponDeductionFee()!=null){
                results.setDeducmoney(oaCOrder.getCouponDeductionFee().setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue());
            }else {
                results.setDeducmoney(0d);
            }
            if(oaCOrder.getStartFee()!=null){
                results.setStartmoney(oaCOrder.getStartFee().setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue());
            }else {
                results.setStartmoney(0d);
            }
            if(oaCOrder.getStartMileage()!=null){
                results.setStartmileage(oaCOrder.getStartMileage().longValue());
            }else {
                results.setStartmileage(0l);
            }
            //等待时间
            if(oaCOrder.getArriveMeetPassengerTime()!=null){
                results.setWaittime(oaCOrder.getArriveMeetPassengerTime().getTime());

            }else {
                results.setWaittime(0l);
            }
            if(oaCOrder.getMileageFee()!=null){
                results.setMileagemoney(oaCOrder.getMileageFee().setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue());
            }

        }
        return Rv.wrap(results);
    }

    @Override
    public Rv deleteOrder(OrderParam orderParam) {


        if (StringUtils.isBlank(orderParam.getOrderId())){
            return Rv.error(EErrorCode.missingArg);
        }

        //获取用户最新订单号
        QueryWrapper<OaCOrderPersonal> queryVersion = new QueryWrapper<>();
        queryVersion.eq(OaCOrderPersonal.DELETED, 0);
        queryVersion.eq(OaCOrderPersonal.USER_ID,orderParam.getUserId());
        queryVersion.eq(OaCOrderPersonal.ORDER_NO,orderParam.getOrderId());
        OaCOrderPersonal oaCOrder = oaCOrderPersonalMapper.selectOne(queryVersion);
        if(oaCOrder==null){
            return Rv.error(EErrorCode.OrderNotExist);
        }
        if(oaCOrder.getOrderStatus()==1||oaCOrder.getOrderStatus()==10||
                oaCOrder.getOrderStatus()==12||oaCOrder.getOrderStatus()==16){

        }
//        OrderDetailParam param=new OrderDetailParam();
//        param.setOrder_id(orderParam.getOrderId());
//        param.seti(orderParam.getCancelReason());
//        // 取消订单修改状态
//        producer.sendMsg(param, MqConstant.DIDI_CANCEL_ORDER);
        return Rv.wrap();
    }

    /**
     * 订单状态转换
     * @param st
     * @return
     */
    private Integer getState(Integer st){

        //0:等待应答1:等待接驾2:到达预约地点3:开始计费4:结束计费5:未付款 6:待评价7:已评价8:已取消
        if(st==1||st==16||st==10){
            return 8;
        }
        if(st==2 || st==4) return 1;
        if(st==5) return 2;
        if(st==6) return 3;
        if(st==7) return 5;
        if(st==12) return 6;

        return st;

//        0：等待应答
//        1：订单超时
//        2：改派中
//        4：司机已接单
//        5：司机到达
//        6：行程中
//        7：正常订单待支付
//        8：取消行程待支付
//        10：取消订单无需支付
//        12：已支付
//        16：客服关闭
//        17：该订单已被其他平台受理

    }

    private String getStateDes(Integer st){

        if(st==1||st==16||st==10){
            return "已取消";
        }
        if(st==2 || st==4) return "等待接驾";
        if(st==5) return "到达预约地点";
        if(st==7) return "未付款";
        if(st==12) return "已评价";
        if(st==0) return "等待应答";
        if(st==4) return "结束计费";
        if(st==6) return "待评价";
        return "";
    }

}
